-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(regression): Support input path globbing in Go re-write #23
Conversation
…e passing when the fix is implemented
@@ -241,7 +241,7 @@ func (a *Action) Apply() error { | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were logging the wrong resource type here, just cosmetic.
@@ -491,25 +491,41 @@ func (a *Action) WriteBack() error { | |||
|
|||
// decodeAnyResourceFile takes a file path and decodes it into a slice of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same logic, just inside a for loop iterating over matches
found by the globbing. If it is a single file without glob chars, it will just iterate once on that file.
@@ -522,3 +522,51 @@ func TestDecodeAnyResourceFile(t *testing.T) { | |||
require.Contains(t, platforms, v, "Expected platform label to be one of %v, got %s", platforms, v) | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests failed before implementing the fix.
The input file path is supported but is not working after the Go re-write v1.4.0.
Tests were added to confirm the failure, they pass now.
Re-wrote
validateFilePaths
and updateddecodeAnyResourceFile
functions to support glob matches before reading resources. The action is validation-heavy, we have two layers of protection here.filepath.Glob
can return nil matches and a nil error, so we always need to check if the matches are nil. If it is, it could indicate an io error in rare cases. Glob will only return an error if the match pattern is invalid. https://pkg.go.dev/path/filepath#GlobThis change is backward compatible.
Testing
My test repo is passing, using globbing for the configuration path. https://github.com/jsirianni/bindplane-op-action-test/actions/runs/9207348741/job/25328061583